<script>
	export default {
		globalData: {
			lng: '', // 经度
			lat: '', // 纬度
			userInfo: null,
			navHeight: 0,
			navTop: 0,
			jnheight: 0,
			jnwidth: 0,
			jnright: 0,
			tabBar: {
				borderStyle: "black",
				backgroundColor: "#FFFFFFFF",
				color: "#999999",
				selectedColor: "#2E3033",
				list: [{
						pagePath: "pages/index/index",
						iconPath: "static/img/tabbar/home.png",
						selectedIconPath: "static/img/tabbar/homeactive.png",
						text: "首页"
					},
					{
						pagePath: "pages/find/find",
						iconPath: "static/img/tabbar/guanzhu.png",
						selectedIconPath: "static/img/tabbar/guanzhuactive.png",
						text: "发现"
					},
					{
						pagePath: "pages/index/index/index-vipsearch",
						iconPath: "static/img/tabbar/add-btn.png",
						selectedIconPath: "static/img/tabbar/add-btn.png",
						text: "",
						addbtn: true
					},
					{
						pagePath: "pages/message/message",
						iconPath: "static/img/tabbar/news.png",
						selectedIconPath: "static/img/tabbar/newsactive.png",
						text: "消息"
					},
					{
						pagePath: "pages/mine/mine",
						iconPath: "static/img/tabbar/me.png",
						selectedIconPath: "static/img/tabbar/meactive.png",
						text: "我的"
					}
				]
			}
		},
		onLaunch: function() {
			let that = this;
			console.log('App Launch');
			//角标
			// setTimeout(() => {
			// 	uni.setTabBarBadge({
			// 		index: 2,
			// 		text: '31'
			// 	});
			// 	uni.showTabBarRedDot({
			// 		index: 0
			// 	});
			// }, 1000);
			//系统信息
			wx.getSystemInfo({
				success: res => {
					//状态栏的高度
					let statusBarHeight = res.statusBarHeight,
						//胶囊按钮与顶部的距离
						navTop = menuButtonObject.top,
						navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top -
							statusBarHeight) * 2;
					that.globalData.navHeight = navHeight; //导航栏高度
					that.globalData.navTop = navTop; //胶囊按钮与顶部的距离
					that.globalData.jnheight = menuButtonObject.height; //胶囊的高度
					that.globalData.jnwidth = menuButtonObject.width; //胶囊的宽度
					that.globalData.jnright = res.windowWidth - menuButtonObject.right; // 胶囊距离页面右侧的宽度
				},
				fail(err) {
					console.log(err);
				}
			});

		},
		// editTabbar: function() {
		// 	let tabbar = this.globalData.tabBar;
		// 	let currentPages = getCurrentPages();
		// 	let _this = currentPages[currentPages.length - 1];
		// 	let pagePath = _this.route;
		// 	(pagePath.indexOf('/') != 0) && (pagePath = '/' + pagePath);
		// 	for (let i in tabbar.list) {
		// 		tabbar.list[i].selected = false;
		// 		(tabbar.list[i].pagePath == pagePath) && (tabbar.list[i].selected = true);
		// 	}
		// 	_this.setData({
		// 		tabbar: tabbar
		// 	});
		// },
		onShow: function() {
			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		},

	};
</script>

<style lang="scss">
	@import 'static/style/index.scss'
</style>
